package com.ocom.srvpaccess.service.impl;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ocom.common.entity.master.EntityDeviceLogin;
import com.ocom.common.enums.DataSourceEnum;
import com.ocom.common.enums.MasterSlaveEnum;
import com.ocom.mysql.aspect.DataSourceAspect;
import com.ocom.srvpaccess.dao.IDaoDeviceLogin;
import com.ocom.srvpaccess.service.DeviceLoginService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class DeviceLoginServiceImpl extends ServiceImpl<IDaoDeviceLogin, EntityDeviceLogin> implements DeviceLoginService {

    @Autowired
    private IDaoDeviceLogin iDaoDeviceLogin;

    /*
     * @Description: 羊城通 参数yct_para说明
     * @Author: lu 
     * @Date: 2022/4/12 9:31
     * @param companyId: 
     * @param machNo:  
     * @return: com.ocom.common.entity.master.EntityDeviceLogin
     **/
    @DataSourceAspect(type= DataSourceEnum.MAIN_DB,isMaster = MasterSlaveEnum.SLAVE)
    @Override
    public EntityDeviceLogin selectYCT(Long comId, String machNo) {
        QueryWrapper<EntityDeviceLogin> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("com_id", comId);
        queryWrapper.eq("device_no", machNo);
        EntityDeviceLogin deviceLogin=iDaoDeviceLogin.selectOne(queryWrapper);
        return deviceLogin;
    }
}
